<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";	
%>
<html>
<head>
<base href="<%=basePath %>"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加社区经理</title>
<jsp:include page="../../../common/easyui-css.inc" flush="true"/>
</head>
<body>
<form name="uploadCustomer" id="uploadCustomer" method="post" enctype="multipart/form-data">
<table class="table_save" width="96%" cellspacing="1" cellpadding="1" border="0">	
  <tr>  
   <td width="200">
	 <input type="file" name="upload" id="upload" class="input_file" style="width: 90%;" />
   </td>					
  </tr>		
</table>
<div id="dlg-buttons" style="text-align: center;margin-top: 10px;margin-right: 20px;"> 
    <a id="menu_save_btn" href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-save">导入</a> 
    <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:parent.$('#uploadWin').window('close')">取消</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-undo" onclick="download();">下载模版</a>          
</div> 
</form>
<jsp:include page="../../../common/easyui-js.inc" flush="true"/>
<script type="text/javascript">
function getExt(filename){ 
  var ext = getFileExt(filename);  
  var s = ext.toLowerCase(); 
  return (s==".xls")?true:false;
}
 $("#menu_save_btn").click(function(){
     var appendix = $("#upload").val();
     if(isEmpty(appendix)){        
         $.messager.alert("系统提示","请选择要导入的文件！","warning");
         return;
     }
     var b = getExt(appendix);
	 if(!b){
	   $.messager.alert("系统提示","请选择Excel文件进行导入！","warning");
	   return;
	 }
	 submitForm({
       formId:'uploadCustomer',
       url:'userLoginController.do?method=uploadUser',
       callback:function(data){
          if(data=="SUCCESS"){   	   	  
   	  		$.messager.alert("系统提示","用户信息导入成功！","info");
   		  }else if(data=="FAIL"){   	  
   	  		$.messager.alert("系统提示","用户信息导入失败，请重试！","error");
   		  }else{
   	  		$.messager.alert("系统提示",data,"error");	
   		  }
       }
    });
 });
 function download(){
    window.location.href="../../../template/customer.xls";
 }
</script>
</body>
</html>
